package security;

/**
 *
 * @author MONESI
 */
import boundary.EventManager;
import boundary.InviteManager;
import boundary.NotificationManager;
import boundary.ParticipantFacade;
import boundary.UserManager;
import entity.Notification;
import entity.Participant;
import java.io.Serializable;
import java.util.List;
import java.util.Vector;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;


@Named
@SessionScoped
public class NotificationBean implements Serializable {
     
    @Inject
    EventBean eb;
      
    @EJB
    private NotificationManager nm;
    
    @EJB
    private UserManager um;
   
        
    
    Notification news;

    public NotificationBean() {
    }
    
     public Notification getNotification() {
        if (news == null) {
            news = new Notification();
        }
        return news;
    }
    
    

    public void setNotification (Notification news) {
        this.news = news;
    }
    
    
         
            
    public String azzeraNotifiche(){
        
        nm.azzera(um.getLoggedUser().getEmail());
        return "ScheduleView";                   
    }
    
    public List<Integer> numberOfNot(){
        
        return nm.number(um.getLoggedUser().getEmail());
                              
    }
    
    public List<String> contenuto(){
        
        return nm.notificheNonLette(um.getLoggedUser().getEmail());
                              
    }
    
    public void register() {
       
        nm.save(news);    
    }
    

}
